from common.deps import get_db
from models.user import user_model
from models.role import role_model
from models.user_role import user_role_model
from fastapi import APIRouter, Depends
from sqlalchemy.orm.session import Session
from db.database import engine,Base

#db = get_db()


if __name__ == "__main__":
    #db: Session = Depends(get_db)
    db = next(get_db())
    #Base.metadata.create_all(engine) 
    #user = user_model('2021141445', "admin", "admin",'superjin','15151953711','','','','','')
    user = db.query(user_model).filter(user_model.user_id == '2021141445').first()
    print(user.roles[0].role)
    #user.roles=[user_role_model(1)]
    #db.add(user)
    db.commit()
    db.query(user_model).offset(0).limit(1000).all()